home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 10 / BBS In A Box Volume X (AMUG) (January 1994).bin / Files / Prog / U-Z / VideoToolBox.cpt / Demos / Grating.c < prev    next >
MacBinary  |  1993-03-07  |  5.3 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun Mar 7 01:34:14 1993, modified Sun Mar 7 01:34:14 1993, creator Think C, type ASCII, 4852 bytes "Grating.c" , at 0x1374 330 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 47 72 61 74 69 6e | 67 2e 63 00 00 00 00 00 |..Gratin|g.c.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 12 f4 00 | 00 01 4a a7 bf 47 e6 a7 |........|..J..G..|
|00000060| bf 47 e6 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.G......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 15 62 00 00 |........|.....b..|
|00000080| 2f 2a 0d 47 72 61 74 69 | 6e 67 2e 63 0d 54 68 69 |/*.Grati|ng.c.Thi|
|00000090| 73 20 64 65 6d 6f 20 73 | 68 6f 77 73 20 68 6f 77 |s demo s|hows how|
|000000a0| 20 74 6f 20 6c 6f 61 64 | 20 74 68 65 20 63 6c 75 | to load| the clu|
|000000b0| 74 20 61 6e 64 20 70 75 | 74 20 61 20 76 69 67 6e |t and pu|t a vign|
|000000c0| 65 74 74 65 64 20 67 72 | 61 74 69 6e 67 20 6f 6e |etted gr|ating on|
|000000d0| 74 6f 20 74 68 65 0d 73 | 63 72 65 65 6e 2e 20 54 |to the.s|creen. T|
|000000e0| 68 69 73 20 64 65 6d 6f | 20 68 61 73 20 62 65 65 |his demo| has bee|
|000000f0| 6e 20 6b 65 70 74 20 61 | 73 20 73 69 6d 70 6c 65 |n kept a|s simple|
|00000100| 20 61 73 20 70 6f 73 73 | 69 62 6c 65 2c 20 74 6f | as poss|ible, to|
|00000110| 20 65 6e 68 61 6e 63 65 | 20 72 65 61 64 61 62 69 | enhance| readabi|
|00000120| 6c 69 74 79 2c 0d 66 6f | 72 73 61 6b 69 6e 67 20 |lity,.fo|rsaking |
|00000130| 61 63 63 75 72 61 74 65 | 20 63 6f 6e 74 72 6f 6c |accurate| control|
|00000140| 20 6f 76 65 72 20 74 69 | 6d 65 20 61 6e 64 20 63 | over ti|me and c|
|00000150| 6f 6e 74 72 61 73 74 20 | 6f 66 20 74 68 65 20 73 |ontrast |of the s|
|00000160| 74 69 6d 75 6c 75 73 2e | 20 54 68 65 0d 46 6c 69 |timulus.| The.Fli|
|00000170| 63 6b 65 72 69 6e 67 47 | 72 61 74 69 6e 67 20 64 |ckeringG|rating d|
|00000180| 65 6d 6f 2c 20 6f 6e 20 | 74 68 65 20 6f 74 68 65 |emo, on |the othe|
|00000190| 72 20 68 61 6e 64 2c 20 | 69 73 20 73 6f 6d 65 77 |r hand, |is somew|
|000001a0| 68 61 74 20 6d 6f 72 65 | 20 65 6c 61 62 6f 72 61 |hat more| elabora|
|000001b0| 74 65 20 61 6e 64 0d 70 | 72 65 73 65 6e 74 73 20 |te and.p|resents |
|000001c0| 61 20 72 65 73 65 61 72 | 63 68 2d 67 72 61 64 65 |a resear|ch-grade|
|000001d0| 20 73 74 69 6d 75 6c 75 | 73 20 69 66 20 74 68 65 | stimulu|s if the|
|000001e0| 20 4c 75 6d 69 6e 61 6e | 63 65 52 65 63 6f 72 64 | Luminan|ceRecord|
|000001f0| 2e 68 20 63 61 6c 69 62 | 72 61 74 69 6f 6e 20 64 |.h calib|ration d|
|00000200| 61 74 61 20 61 72 65 0d | 61 63 63 75 72 61 74 65 |ata are.|accurate|
|00000210| 2e 0d 0d 46 6f 72 20 61 | 20 72 65 61 6c 20 65 78 |...For a| real ex|
|00000220| 70 65 72 69 6d 65 6e 74 | 20 74 68 65 72 65 20 61 |periment| there a|
|00000230| 72 65 20 73 6f 6d 65 20 | 72 65 66 69 6e 65 6d 65 |re some |refineme|
|00000240| 6e 74 73 20 79 6f 75 20 | 73 68 6f 75 6c 64 20 63 |nts you |should c|
|00000250| 6f 6e 73 69 64 65 72 2e | 20 54 68 69 73 20 64 65 |onsider.| This de|
|00000260| 6d 6f 0d 74 61 6b 65 73 | 20 61 20 77 68 69 6c 65 |mo.takes| a while|
|00000270| 20 74 6f 20 63 72 65 61 | 74 65 20 74 68 65 20 69 | to crea|te the i|
|00000280| 6d 61 67 65 20 6f 6e 20 | 74 68 65 20 73 63 72 65 |mage on |the scre|
|00000290| 65 6e 2c 20 62 75 74 20 | 79 6f 75 20 70 72 6f 62 |en, but |you prob|
|000002a0| 61 62 6c 79 20 77 61 6e | 74 0d 66 72 61 6d 65 2d |ably wan|t.frame-|
|000002b0| 61 63 63 75 72 61 74 65 | 20 74 69 6d 69 6e 67 20 |accurate| timing |
|000002c0| 69 6e 20 79 6f 75 72 20 | 65 78 70 65 72 69 6d 65 |in your |experime|
|000002d0| 6e 74 2e 20 59 6f 75 20 | 63 6f 75 6c 64 20 65 69 |nt. You |could ei|
|000002e0| 74 68 65 72 20 63 72 65 | 61 74 65 20 74 68 65 20 |ther cre|ate the |
|000002f0| 69 6d 61 67 65 20 69 6e | 0d 61 6e 20 6f 66 66 73 |image in|.an offs|
|00000300| 63 72 65 65 6e 20 47 57 | 6f 72 6c 64 20 61 6e 64 |creen GW|orld and|
|00000310| 20 63 6f 70 79 20 69 74 | 20 74 6f 20 74 68 65 20 | copy it| to the |
|00000320| 73 63 72 65 65 6e 20 77 | 69 74 68 20 43 6f 70 79 |screen w|ith Copy|
|00000330| 42 69 74 73 51 75 69 63 | 6b 6c 79 2e 20 4f 72 20 |BitsQuic|kly. Or |
|00000340| 79 6f 75 20 63 6f 75 6c | 64 0d 73 65 74 20 74 68 |you coul|d.set th|
|00000350| 65 20 63 6c 75 74 20 74 | 6f 20 75 6e 69 66 6f 72 |e clut t|o unifor|
|00000360| 6d 20 67 72 61 79 20 28 | 65 76 65 72 79 20 63 6c |m gray (|every cl|
|00000370| 75 74 20 65 6e 74 72 79 | 20 65 71 75 61 6c 20 74 |ut entry| equal t|
|00000380| 6f 20 74 68 65 20 62 61 | 63 6b 67 72 6f 75 6e 64 |o the ba|ckground|
|00000390| 0d 6c 75 6d 69 6e 61 6e | 63 65 29 20 77 68 69 6c |.luminan|ce) whil|
|000003a0| 65 20 79 6f 75 27 72 65 | 20 63 6f 6d 70 75 74 69 |e you're| computi|
|000003b0| 6e 67 20 74 68 65 20 69 | 6d 61 67 65 20 6f 6e 2d |ng the i|mage on-|
|000003c0| 73 63 72 65 65 6e 2c 20 | 61 6e 64 20 74 68 65 6e |screen, |and then|
|000003d0| 20 6c 6f 61 64 20 61 20 | 67 72 61 79 73 63 61 6c | load a |grayscal|
|000003e0| 65 0d 72 61 6d 70 20 69 | 6e 74 6f 20 74 68 65 20 |e.ramp i|nto the |
|000003f0| 63 6c 75 74 20 77 68 65 | 6e 20 79 6f 75 20 77 61 |clut whe|n you wa|
|00000400| 6e 74 20 74 68 65 20 64 | 69 73 70 6c 61 79 20 74 |nt the d|isplay t|
|00000410| 6f 20 73 74 61 72 74 2e | 20 53 69 6d 69 6c 61 72 |o start.| Similar|
|00000420| 6c 79 20 79 6f 75 20 63 | 61 6e 20 6d 61 6b 65 0d |ly you c|an make.|
|00000430| 74 68 65 20 69 6d 61 67 | 65 20 64 69 73 61 70 70 |the imag|e disapp|
|00000440| 65 61 72 20 62 79 20 65 | 69 74 68 65 72 20 6c 6f |ear by e|ither lo|
|00000450| 61 64 69 6e 67 20 61 20 | 6e 65 77 20 69 6d 61 67 |ading a |new imag|
|00000460| 65 2c 20 63 6c 65 61 72 | 69 6e 67 20 74 68 65 20 |e, clear|ing the |
|00000470| 73 63 72 65 65 6e 20 62 | 79 0d 63 61 6c 6c 69 6e |screen b|y.callin|
|00000480| 67 20 45 72 61 73 65 52 | 65 63 74 28 29 2c 20 6f |g EraseR|ect(), o|
|00000490| 72 20 6c 6f 61 64 69 6e | 67 20 61 20 75 6e 69 66 |r loadin|g a unif|
|000004a0| 6f 72 6d 2d 67 72 61 79 | 20 63 6c 75 74 2e 0d 0d |orm-gray| clut...|
|000004b0| 41 6e 6f 74 68 65 72 20 | 69 73 73 75 65 20 74 68 |Another |issue th|
|000004c0| 61 74 20 6d 61 74 74 65 | 72 73 20 66 6f 72 20 61 |at matte|rs for a|
|000004d0| 20 72 65 61 6c 20 65 78 | 70 65 72 69 6d 65 6e 74 | real ex|periment|
|000004e0| 20 69 73 20 67 61 6d 6d | 61 20 63 6f 72 72 65 63 | is gamm|a correc|
|000004f0| 74 69 6f 6e 2e 20 54 68 | 65 0d 6e 75 6d 62 65 72 |tion. Th|e.number|
|00000500| 73 20 6c 6f 61 64 65 64 | 20 69 6e 74 6f 20 74 68 |s loaded| into th|
|00000510| 65 20 63 6c 75 74 20 61 | 72 65 20 66 61 69 74 68 |e clut a|re faith|
|00000520| 66 75 6c 6c 79 20 74 72 | 61 6e 73 66 6f 72 6d 65 |fully tr|ansforme|
|00000530| 64 20 69 6e 74 6f 20 76 | 6f 6c 74 61 67 65 73 20 |d into v|oltages |
|00000540| 62 79 20 74 68 65 0d 74 | 68 72 65 65 20 64 69 67 |by the.t|hree dig|
|00000550| 69 74 61 6c 2d 74 6f 2d | 61 6e 61 6c 6f 67 20 63 |ital-to-|analog c|
|00000560| 6f 6e 76 65 72 74 65 72 | 73 20 6f 6e 20 79 6f 75 |onverter|s on you|
|00000570| 72 20 76 69 64 65 6f 20 | 63 61 72 64 2c 20 62 75 |r video |card, bu|
|00000580| 74 20 74 68 65 20 72 65 | 73 75 6c 74 69 6e 67 0d |t the re|sulting.|
|00000590| 6c 75 6d 69 6e 61 6e 63 | 65 20 70 72 6f 64 75 63 |luminanc|e produc|
|000005a0| 65 64 20 6f 6e 20 79 6f | 75 72 20 6d 6f 6e 69 74 |ed on yo|ur monit|
|000005b0| 6f 72 20 77 69 6c 6c 20 | 62 65 20 61 6e 20 61 70 |or will |be an ap|
|000005c0| 70 72 6f 78 69 6d 61 74 | 65 6c 79 20 70 61 72 61 |proximat|ely para|
|000005d0| 62 6f 6c 69 63 20 66 75 | 6e 63 74 69 6f 6e 0d 6f |bolic fu|nction.o|
|000005e0| 66 20 74 68 65 20 76 69 | 64 65 6f 20 76 6f 6c 74 |f the vi|deo volt|
|000005f0| 61 67 65 2e 20 41 70 70 | 6c 65 20 70 72 6f 76 69 |age. App|le provi|
|00000600| 64 65 73 20 63 72 75 64 | 65 20 67 61 6d 6d 61 20 |des crud|e gamma |
|00000610| 63 6f 72 72 65 63 74 69 | 6f 6e 20 62 79 20 6d 65 |correcti|on by me|
|00000620| 61 6e 73 20 6f 66 20 61 | 0d 67 65 6e 65 72 69 63 |ans of a|.generic|
|00000630| 20 38 2d 62 69 74 20 67 | 61 6d 6d 61 20 74 61 62 | 8-bit g|amma tab|
|00000640| 6c 65 20 69 6e 20 74 68 | 65 20 76 69 64 65 6f 20 |le in th|e video |
|00000650| 64 72 69 76 65 72 2c 20 | 77 68 69 63 68 20 64 6f |driver, |which do|
|00000660| 65 73 20 6d 61 6b 65 20 | 74 68 69 6e 67 73 20 6c |es make |things l|
|00000670| 6f 6f 6b 0d 62 65 74 74 | 65 72 2c 20 62 75 74 20 |ook.bett|er, but |
|00000680| 69 73 20 6e 6f 74 20 61 | 63 63 75 72 61 74 65 6c |is not a|ccuratel|
|00000690| 79 20 6d 61 74 63 68 65 | 64 20 74 6f 20 74 68 65 |y matche|d to the|
|000006a0| 20 67 61 6d 6d 61 20 6f | 66 20 79 6f 75 72 20 70 | gamma o|f your p|
|000006b0| 61 72 74 69 63 75 6c 61 | 72 20 6d 6f 6e 69 74 6f |articula|r monito|
|000006c0| 72 2c 0d 77 68 69 63 68 | 20 64 65 70 65 6e 64 73 |r,.which| depends|
|000006d0| 20 6f 6e 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | on the |current |
|000006e0| 73 65 74 74 69 6e 67 73 | 20 6f 66 20 69 74 73 20 |settings| of its |
|000006f0| 62 72 69 67 68 74 6e 65 | 73 73 20 61 6e 64 20 63 |brightne|ss and c|
|00000700| 6f 6e 74 72 61 73 74 20 | 6b 6e 6f 62 73 2e 0d 46 |ontrast |knobs..F|
|00000710| 75 72 74 68 65 72 6d 6f | 72 65 20 74 68 65 20 41 |urthermo|re the A|
|00000720| 70 70 6c 65 20 38 2d 62 | 69 74 20 67 61 6d 6d 61 |pple 8-b|it gamma|
|00000730| 2d 63 6f 72 72 65 63 74 | 69 6f 6e 20 73 63 68 65 |-correct|ion sche|
|00000740| 6d 65 2c 20 77 68 69 63 | 68 20 73 69 6d 70 6c 79 |me, whic|h simply|
|00000750| 20 74 72 61 6e 73 66 6f | 72 6d 73 20 74 68 65 0d | transfo|rms the.|
|00000760| 6e 6f 6d 69 6e 61 6c 20 | 38 2d 62 69 74 20 63 6c |nominal |8-bit cl|
|00000770| 75 74 20 76 61 6c 75 65 | 20 69 6e 74 6f 20 61 20 |ut value| into a |
|00000780| 6e 65 77 20 38 2d 62 69 | 74 20 63 6c 75 74 20 76 |new 8-bi|t clut v|
|00000790| 61 6c 75 65 2c 20 6e 65 | 63 65 73 73 61 72 69 6c |alue, ne|cessaril|
|000007a0| 79 20 72 65 73 74 72 69 | 63 74 73 20 74 68 65 0d |y restri|cts the.|
|000007b0| 72 61 6e 67 65 20 6f 66 | 20 61 76 61 69 6c 61 62 |range of| availab|
|000007c0| 6c 65 20 76 61 6c 75 65 | 73 2c 20 6d 61 70 70 69 |le value|s, mappi|
|000007d0| 6e 67 20 73 65 76 65 72 | 61 6c 20 6f 6e 74 6f 20 |ng sever|al onto |
|000007e0| 6f 6e 65 20 6f 75 74 70 | 75 74 20 76 61 6c 75 65 |one outp|ut value|
|000007f0| 2c 20 61 6e 64 20 6f 6d | 69 74 74 69 6e 67 0d 73 |, and om|itting.s|
|00000800| 6f 6d 65 20 6f 75 74 70 | 75 74 20 76 61 6c 75 65 |ome outp|ut value|
|00000810| 73 2e 20 49 6e 20 6f 74 | 68 65 72 20 77 6f 72 64 |s. In ot|her word|
|00000820| 73 20 79 6f 75 72 20 6c | 75 6d 69 6e 61 6e 63 65 |s your l|uminance|
|00000830| 73 20 77 69 6c 6c 20 62 | 65 20 38 2d 62 69 74 20 |s will b|e 8-bit |
|00000840| 71 75 61 6e 74 69 7a 65 | 64 0d 74 77 69 63 65 2c |quantize|d.twice,|
|00000850| 20 62 6f 74 68 20 62 65 | 66 6f 72 65 20 61 6e 64 | both be|fore and|
|00000860| 20 61 66 74 65 72 20 67 | 61 6d 6d 61 20 63 6f 72 | after g|amma cor|
|00000870| 72 65 63 74 69 6f 6e 2e | 20 49 74 20 69 73 20 70 |rection.| It is p|
|00000880| 72 65 66 65 72 61 62 6c | 65 20 74 6f 20 64 6f 20 |referabl|e to do |
|00000890| 67 61 6d 6d 61 0d 63 6f | 72 72 65 63 74 69 6f 6e |gamma.co|rrection|
|000008a0| 20 66 69 72 73 74 2c 20 | 77 69 74 68 6f 75 74 20 | first, |without |
|000008b0| 71 75 61 6e 74 69 7a 61 | 74 69 6f 6e 2e 20 54 68 |quantiza|tion. Th|
|000008c0| 65 72 65 66 6f 72 65 20 | 49 20 73 75 67 67 65 73 |erefore |I sugges|
|000008d0| 74 20 79 6f 75 20 65 6c | 69 6d 69 6e 61 74 65 0d |t you el|iminate.|
|000008e0| 41 70 70 6c 65 27 73 20 | 67 61 6d 6d 61 20 63 6f |Apple's |gamma co|
|000008f0| 72 72 65 63 74 69 6f 6e | 2c 20 62 79 20 63 61 6c |rrection|, by cal|
|00000900| 6c 69 6e 67 20 47 44 55 | 6e 63 6f 72 72 65 63 74 |ling GDU|ncorrect|
|00000910| 65 64 47 61 6d 6d 61 28 | 29 2c 20 61 6e 64 20 75 |edGamma(|), and u|
|00000920| 73 65 20 74 68 65 0d 4c | 75 6d 69 6e 61 6e 63 65 |se the.L|uminance|
|00000930| 2e 63 20 70 61 63 6b 61 | 67 65 20 74 6f 20 64 6f |.c packa|ge to do|
|00000940| 20 67 61 6d 6d 61 20 63 | 6f 72 72 65 63 74 69 6f | gamma c|orrectio|
|00000950| 6e 2e 20 54 68 61 74 20 | 70 61 63 6b 61 67 65 20 |n. That |package |
|00000960| 69 6d 70 6c 65 6d 65 6e | 74 73 20 74 68 65 0d 70 |implemen|ts the.p|
|00000970| 75 62 6c 69 73 68 65 64 | 20 61 6c 67 6f 72 69 74 |ublished| algorit|
|00000980| 68 6d 20 6f 66 20 50 65 | 6c 6c 69 20 61 6e 64 20 |hm of Pe|lli and |
|00000990| 5a 68 61 6e 67 20 28 31 | 39 39 31 29 2e 20 54 68 |Zhang (1|991). Th|
|000009a0| 65 20 46 6c 69 63 6b 65 | 72 69 6e 67 47 72 61 74 |e Flicke|ringGrat|
|000009b0| 69 6e 67 20 64 65 6d 6f | 20 75 73 65 73 0d 4c 75 |ing demo| uses.Lu|
|000009c0| 6d 69 6e 61 6e 63 65 2e | 63 2e 0d 0d 48 49 53 54 |minance.|c...HIST|
|000009d0| 4f 52 59 3a 0d 32 2f 37 | 2f 39 33 09 64 67 70 20 |ORY:.2/7|/93.dgp |
|000009e0| 77 72 6f 74 65 20 69 74 | 2c 20 61 73 20 61 6e 20 |wrote it|, as an |
|000009f0| 61 6e 73 77 65 72 20 74 | 6f 20 71 75 65 73 74 69 |answer t|o questi|
|00000a00| 6f 6e 73 20 66 72 6f 6d | 20 42 69 6c 6c 20 4d 65 |ons from| Bill Me|
|00000a10| 72 69 67 61 6e 20 61 6e | 64 20 44 61 76 69 64 20 |rigan an|d David |
|00000a20| 42 72 61 69 6e 61 72 64 | 2e 0d 32 2f 31 38 2f 39 |Brainard|..2/18/9|
|00000a30| 33 09 64 67 70 09 61 64 | 64 65 64 20 66 70 75 20 |3.dgp.ad|ded fpu |
|00000a40| 74 65 73 74 2e 0d 32 2f | 32 33 2f 39 33 09 64 67 |test..2/|23/93.dg|
|00000a50| 70 09 75 73 65 20 6e 65 | 77 20 47 44 4f 70 65 6e |p.use ne|w GDOpen|
|00000a60| 57 69 6e 64 6f 77 31 20 | 61 6e 64 20 47 44 44 69 |Window1 |and GDDi|
|00000a70| 73 70 6f 73 65 57 69 6e | 64 6f 77 31 2e 0d 2a 2f |sposeWin|dow1..*/|
|00000a80| 0d 23 69 6e 63 6c 75 64 | 65 20 22 56 69 64 65 6f |.#includ|e "Video|
|00000a90| 54 6f 6f 6c 62 6f 78 2e | 68 22 0d 23 69 6e 63 6c |Toolbox.|h".#incl|
|00000aa0| 75 64 65 20 3c 6d 61 74 | 68 2e 68 3e 0d 23 69 66 |ude <mat|h.h>.#if|
|00000ab0| 20 54 48 49 4e 4b 5f 43 | 0d 09 23 69 6e 63 6c 75 | THINK_C|..#inclu|
|00000ac0| 64 65 20 3c 63 6f 6e 73 | 6f 6c 65 2e 68 3e 0d 23 |de <cons|ole.h>.#|
|00000ad0| 65 6e 64 69 66 0d 23 64 | 65 66 69 6e 65 20 53 49 |endif.#d|efine SI|
|00000ae0| 5a 45 20 33 30 30 0d 0d | 76 6f 69 64 20 6d 61 69 |ZE 300..|void mai|
|00000af0| 6e 28 76 6f 69 64 29 0d | 7b 0d 09 69 6e 74 20 69 |n(void).|{..int i|
|00000b00| 2c 6a 2c 65 72 72 6f 72 | 2c 63 6f 6c 6f 72 73 3b |,j,error|,colors;|
|00000b10| 0d 09 47 44 48 61 6e 64 | 6c 65 20 64 65 76 69 63 |..GDHand|le devic|
|00000b20| 65 3b 0d 09 73 74 61 74 | 69 63 20 43 6f 6c 6f 72 |e;..stat|ic Color|
|00000b30| 53 70 65 63 20 74 61 62 | 6c 65 5b 32 35 36 5d 3b |Spec tab|le[256];|
|00000b40| 0d 09 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |..Window|Ptr wind|
|00000b50| 6f 77 2c 6f 6c 64 50 6f | 72 74 2c 77 3b 0d 09 52 |ow,oldPo|rt,w;..R|
|00000b60| 65 63 74 20 72 3b 0d 09 | 64 6f 75 62 6c 65 20 61 |ect r;..|double a|
|00000b70| 2c 66 58 5b 53 49 5a 45 | 5d 2c 66 59 5b 53 49 5a |,fX[SIZE|],fY[SIZ|
|00000b80| 45 5d 3b 0d 09 63 68 61 | 72 20 73 74 72 69 6e 67 |E];..cha|r string|
|00000b90| 5b 31 30 30 5d 3b 0d 09 | 50 6f 69 6e 74 20 70 74 |[100];..|Point pt|
|00000ba0| 3d 7b 31 30 30 2c 30 7d | 3b 0d 09 0d 09 53 74 61 |={100,0}|;....Sta|
|00000bb0| 63 6b 47 72 6f 77 28 31 | 30 30 30 30 29 3b 0d 09 |ckGrow(1|0000);..|
|00000bc0| 23 69 66 20 54 48 49 4e | 4b 5f 43 0d 09 09 63 6f |#if THIN|K_C...co|
|00000bd0| 6e 73 6f 6c 65 5f 6f 70 | 74 69 6f 6e 73 2e 74 6f |nsole_op|tions.to|
|00000be0| 70 20 3d 20 30 3b 0d 09 | 09 63 6f 6e 73 6f 6c 65 |p = 0;..|.console|
|00000bf0| 5f 6f 70 74 69 6f 6e 73 | 2e 6c 65 66 74 20 3d 20 |_options|.left = |
|00000c00| 30 3b 0d 09 09 63 6f 6e | 73 6f 6c 65 5f 6f 70 74 |0;...con|sole_opt|
|00000c10| 69 6f 6e 73 2e 6e 72 6f | 77 73 20 3d 20 34 3b 0d |ions.nro|ws = 4;.|
|00000c20| 09 09 63 6f 6e 73 6f 6c | 65 5f 6f 70 74 69 6f 6e |..consol|e_option|
|00000c30| 73 2e 6e 63 6f 6c 73 20 | 3d 20 36 30 3b 0d 09 09 |s.ncols |= 60;...|
|00000c40| 70 72 69 6e 74 66 28 22 | 5c 6e 22 29 3b 0d 09 23 |printf("|\n");..#|
|00000c50| 65 6c 73 65 0d 09 09 49 | 6e 69 74 47 72 61 66 28 |else...I|nitGraf(|
|00000c60| 28 50 74 72 29 20 26 74 | 68 65 50 6f 72 74 29 3b |(Ptr) &t|hePort);|
|00000c70| 0d 09 09 49 6e 69 74 46 | 6f 6e 74 73 28 29 3b 0d |...InitF|onts();.|
|00000c80| 09 09 49 6e 69 74 57 69 | 6e 64 6f 77 73 28 29 3b |..InitWi|ndows();|
|00000c90| 0d 09 09 49 6e 69 74 43 | 75 72 73 6f 72 28 29 3b |...InitC|ursor();|
|00000ca0| 0d 09 23 65 6e 64 69 66 | 0d 09 70 72 69 6e 74 66 |..#endif|..printf|
|00000cb0| 28 22 57 65 6c 63 6f 6d | 65 20 74 6f 20 47 72 61 |("Welcom|e to Gra|
|00000cc0| 74 69 6e 67 2e 5c 6e 22 | 29 3b 0d 09 52 65 71 75 |ting.\n"|);..Requ|
|00000cd0| 69 72 65 28 67 65 73 74 | 61 6c 74 38 42 69 74 51 |ire(gest|alt8BitQ|
|00000ce0| 44 29 3b 0d 09 47 65 74 | 50 6f 72 74 28 26 6f 6c |D);..Get|Port(&ol|
|00000cf0| 64 50 6f 72 74 29 3b 0d | 09 64 65 76 69 63 65 3d |dPort);.|.device=|
|00000d00| 47 65 74 53 63 72 65 65 | 6e 44 65 76 69 63 65 28 |GetScree|nDevice(|
|00000d10| 30 29 3b 0d 09 73 77 69 | 74 63 68 28 28 2a 64 65 |0);..swi|tch((*de|
|00000d20| 76 69 63 65 29 2d 3e 67 | 64 54 79 70 65 29 7b 0d |vice)->g|dType){.|
|00000d30| 09 63 61 73 65 20 66 69 | 78 65 64 54 79 70 65 3a |.case fi|xedType:|
|00000d40| 0d 09 09 70 72 69 6e 74 | 66 28 22 41 6c 61 73 2c |...print|f("Alas,|
|00000d50| 20 74 68 69 73 20 64 65 | 76 69 63 65 20 68 61 73 | this de|vice has|
|00000d60| 20 61 20 66 69 78 65 64 | 20 63 6c 75 74 2e 20 50 | a fixed| clut. P|
|00000d70| 72 6f 63 65 65 64 69 6e | 67 20 61 6e 79 77 61 79 |roceedin|g anyway|
|00000d80| 2e 5c 6e 22 29 3b 0d 09 | 09 62 72 65 61 6b 3b 0d |.\n");..|.break;.|
|00000d90| 09 63 61 73 65 20 63 6c | 75 74 54 79 70 65 3a 0d |.case cl|utType:.|
|00000da0| 09 09 62 72 65 61 6b 3b | 0d 09 63 61 73 65 20 64 |..break;|..case d|
|00000db0| 69 72 65 63 74 54 79 70 | 65 3a 0d 09 09 70 72 69 |irectTyp|e:...pri|
|00000dc0| 6e 74 66 28 22 45 78 63 | 75 73 65 20 6d 65 20 77 |ntf("Exc|use me w|
|00000dd0| 68 69 6c 65 20 49 20 63 | 68 61 6e 67 65 20 74 68 |hile I c|hange th|
|00000de0| 65 20 70 69 78 65 6c 20 | 64 65 70 74 68 2e 5c 6e |e pixel |depth.\n|
|00000df0| 22 29 3b 0d 09 09 65 72 | 72 6f 72 20 3d 20 53 65 |");...er|ror = Se|
|00000e00| 74 44 65 70 74 68 28 64 | 65 76 69 63 65 2c 65 69 |tDepth(d|evice,ei|
|00000e10| 67 68 74 42 69 74 4d 6f | 64 65 2c 30 2c 30 29 3b |ghtBitMo|de,0,0);|
|00000e20| 0d 09 09 69 66 28 65 72 | 72 6f 72 29 65 72 72 6f |...if(er|ror)erro|
|00000e30| 72 20 3d 20 53 65 74 44 | 65 70 74 68 28 64 65 76 |r = SetD|epth(dev|
|00000e40| 69 63 65 2c 66 6f 75 72 | 42 69 74 4d 6f 64 65 2c |ice,four|BitMode,|
|00000e50| 30 2c 30 29 3b 0d 09 09 | 69 66 28 65 72 72 6f 72 |0,0);...|if(error|
|00000e60| 29 65 72 72 6f 72 20 3d | 20 53 65 74 44 65 70 74 |)error =| SetDept|
|00000e70| 68 28 64 65 76 69 63 65 | 2c 74 77 6f 42 69 74 4d |h(device|,twoBitM|
|00000e80| 6f 64 65 2c 30 2c 30 29 | 3b 0d 09 09 69 66 28 65 |ode,0,0)|;...if(e|
|00000e90| 72 72 6f 72 29 65 72 72 | 6f 72 20 3d 20 53 65 74 |rror)err|or = Set|
|00000ea0| 44 65 70 74 68 28 64 65 | 76 69 63 65 2c 6f 6e 65 |Depth(de|vice,one|
|00000eb0| 42 69 74 4d 6f 64 65 2c | 30 2c 30 29 3b 0d 09 09 |BitMode,|0,0);...|
|00000ec0| 69 66 28 65 72 72 6f 72 | 29 70 72 69 6e 74 66 28 |if(error|)printf(|
|00000ed0| 22 41 6c 61 73 2c 20 74 | 68 69 73 20 64 65 76 69 |"Alas, t|his devi|
|00000ee0| 63 65 20 64 6f 65 73 6e | 27 74 20 73 75 70 70 6f |ce doesn|'t suppo|
|00000ef0| 72 74 20 6c 65 73 73 20 | 74 68 61 6e 20 31 36 2d |rt less |than 16-|
|00000f00| 62 69 74 20 70 69 78 65 | 6c 73 2c 20 62 75 74 20 |bit pixe|ls, but |
|00000f10| 77 65 27 6c 6c 20 70 72 | 6f 63 65 65 64 20 61 6e |we'll pr|oceed an|
|00000f20| 79 77 61 79 2e 5c 6e 22 | 29 3b 0d 09 09 62 72 65 |yway.\n"|);...bre|
|00000f30| 61 6b 3b 0d 09 7d 0d 09 | 63 6f 6c 6f 72 73 3d 28 |ak;..}..|colors=(|
|00000f40| 2a 2a 28 2a 2a 28 2a 2a | 64 65 76 69 63 65 29 2e |**(**(**|device).|
|00000f50| 67 64 50 4d 61 70 29 2e | 70 6d 54 61 62 6c 65 29 |gdPMap).|pmTable)|
|00000f60| 2e 63 74 53 69 7a 65 2b | 31 3b 0d 09 2f 2f 20 4c |.ctSize+|1;..// L|
|00000f70| 6f 61 64 20 74 68 65 20 | 63 6c 75 74 20 77 69 74 |oad the |clut wit|
|00000f80| 68 20 61 20 67 72 61 79 | 73 63 61 6c 65 20 72 61 |h a gray|scale ra|
|00000f90| 6d 70 2e 0d 09 66 6f 72 | 28 69 3d 30 3b 69 3c 63 |mp...for|(i=0;i<c|
|00000fa0| 6f 6c 6f 72 73 3b 69 2b | 2b 29 7b 0d 09 09 74 61 |olors;i+|+){...ta|
|00000fb0| 62 6c 65 5b 69 5d 2e 72 | 67 62 2e 72 65 64 3d 74 |ble[i].r|gb.red=t|
|00000fc0| 61 62 6c 65 5b 69 5d 2e | 72 67 62 2e 67 72 65 65 |able[i].|rgb.gree|
|00000fd0| 6e 3d 74 61 62 6c 65 5b | 69 5d 2e 72 67 62 2e 62 |n=table[|i].rgb.b|
|00000fe0| 6c 75 65 3d 69 2a 28 6c | 6f 6e 67 29 30 78 66 66 |lue=i*(l|ong)0xff|
|00000ff0| 66 66 2f 28 63 6f 6c 6f | 72 73 2d 31 29 3b 0d 09 |ff/(colo|rs-1);..|
|00001000| 7d 0d 09 73 77 69 74 63 | 68 28 28 2a 64 65 76 69 |}..switc|h((*devi|
|00001010| 63 65 29 2d 3e 67 64 54 | 79 70 65 29 7b 0d 09 63 |ce)->gdT|ype){..c|
|00001020| 61 73 65 20 66 69 78 65 | 64 54 79 70 65 3a 0d 09 |ase fixe|dType:..|
|00001030| 09 62 72 65 61 6b 3b 0d | 09 63 61 73 65 20 63 6c |.break;.|.case cl|
|00001040| 75 74 54 79 70 65 3a 0d | 09 09 65 72 72 6f 72 3d |utType:.|..error=|
|00001050| 47 44 53 65 74 45 6e 74 | 72 69 65 73 28 64 65 76 |GDSetEnt|ries(dev|
|00001060| 69 63 65 2c 30 2c 63 6f | 6c 6f 72 73 2d 31 2c 74 |ice,0,co|lors-1,t|
|00001070| 61 62 6c 65 29 3b 0d 09 | 09 62 72 65 61 6b 3b 0d |able);..|.break;.|
|00001080| 09 63 61 73 65 20 64 69 | 72 65 63 74 54 79 70 65 |.case di|rectType|
|00001090| 3a 0d 09 09 65 72 72 6f | 72 3d 47 44 44 69 72 65 |:...erro|r=GDDire|
|000010a0| 63 74 53 65 74 45 6e 74 | 72 69 65 73 28 64 65 76 |ctSetEnt|ries(dev|
|000010b0| 69 63 65 2c 30 2c 63 6f | 6c 6f 72 73 2d 31 2c 74 |ice,0,co|lors-1,t|
|000010c0| 61 62 6c 65 29 3b 0d 09 | 09 62 72 65 61 6b 3b 0d |able);..|.break;.|
|000010d0| 09 7d 0d 09 53 65 74 4d | 6f 75 73 65 28 70 74 29 |.}..SetM|ouse(pt)|
|000010e0| 3b 0d 09 77 69 6e 64 6f | 77 3d 47 44 4f 70 65 6e |;..windo|w=GDOpen|
|000010f0| 57 69 6e 64 6f 77 31 28 | 64 65 76 69 63 65 29 3b |Window1(|device);|
|00001100| 0d 09 53 65 74 50 6f 72 | 74 28 77 69 6e 64 6f 77 |..SetPor|t(window|
|00001110| 29 3b 0d 09 50 6d 42 61 | 63 6b 43 6f 6c 6f 72 28 |);..PmBa|ckColor(|
|00001120| 28 63 6f 6c 6f 72 73 2d | 31 29 2a 30 2e 35 29 3b |(colors-|1)*0.5);|
|00001130| 09 2f 2f 20 54 68 69 73 | 20 77 6f 72 6b 73 20 62 |.// This| works b|
|00001140| 65 63 61 75 73 65 20 47 | 44 4f 70 65 6e 57 69 6e |ecause G|DOpenWin|
|00001150| 64 6f 77 31 20 6d 61 72 | 6b 65 64 0d 09 45 72 61 |dow1 mar|ked..Era|
|00001160| 73 65 52 65 63 74 28 26 | 77 69 6e 64 6f 77 2d 3e |seRect(&|window->|
|00001170| 70 6f 72 74 52 65 63 74 | 29 3b 09 2f 2f 20 61 6c |portRect|);.// al|
|00001180| 6c 20 74 68 65 20 63 6f | 6c 6f 72 73 20 61 73 20 |l the co|lors as |
|00001190| 70 6d 45 78 70 6c 69 63 | 69 74 2e 0d 09 53 65 74 |pmExplic|it...Set|
|000011a0| 52 65 63 74 28 26 72 2c | 30 2c 30 2c 53 49 5a 45 |Rect(&r,|0,0,SIZE|
|000011b0| 2c 53 49 5a 45 29 3b 0d | 09 43 65 6e 74 65 72 52 |,SIZE);.|.CenterR|
|000011c0| 65 63 74 49 6e 52 65 63 | 74 28 26 72 2c 26 77 69 |ectInRec|t(&r,&wi|
|000011d0| 6e 64 6f 77 2d 3e 70 6f | 72 74 52 65 63 74 29 3b |ndow->po|rtRect);|
|000011e0| 0d 09 66 6f 72 28 69 3d | 30 3b 69 3c 53 49 5a 45 |..for(i=|0;i<SIZE|
|000011f0| 3b 69 2b 2b 29 7b 0d 09 | 09 61 3d 28 69 2d 53 49 |;i++){..|.a=(i-SI|
|00001200| 5a 45 2f 32 29 2f 28 53 | 49 5a 45 2f 36 2e 29 3b |ZE/2)/(S|IZE/6.);|
|00001210| 0d 09 09 66 59 5b 69 5d | 3d 65 78 70 28 2d 61 2a |...fY[i]|=exp(-a*|
|00001220| 61 29 3b 0d 09 09 66 58 | 5b 69 5d 3d 66 59 5b 69 |a);...fX|[i]=fY[i|
|00001230| 5d 2a 73 69 6e 28 28 69 | 2d 53 49 5a 45 2f 32 29 |]*sin((i|-SIZE/2)|
|00001240| 2a 28 32 2e 30 2a 50 49 | 2f 38 30 2e 30 29 29 3b |*(2.0*PI|/80.0));|
|00001250| 0d 09 7d 0d 09 66 6f 72 | 28 6a 3d 30 3b 6a 3c 53 |..}..for|(j=0;j<S|
|00001260| 49 5a 45 3b 6a 2b 2b 29 | 7b 0d 09 09 75 6e 73 69 |IZE;j++)|{...unsi|
|00001270| 67 6e 65 64 20 6c 6f 6e | 67 20 72 6f 77 5b 53 49 |gned lon|g row[SI|
|00001280| 5a 45 5d 3b 0d 09 09 66 | 6f 72 28 69 3d 30 3b 69 |ZE];...f|or(i=0;i|
|00001290| 3c 53 49 5a 45 3b 69 2b | 2b 29 20 72 6f 77 5b 69 |<SIZE;i+|+) row[i|
|000012a0| 5d 3d 30 2e 35 2b 28 63 | 6f 6c 6f 72 73 2d 31 29 |]=0.5+(c|olors-1)|
|000012b0| 2a 30 2e 35 2a 28 31 2e | 30 2b 66 59 5b 6a 5d 2a |*0.5*(1.|0+fY[j]*|
|000012c0| 66 58 5b 69 5d 29 3b 0d | 09 09 53 65 74 50 69 78 |fX[i]);.|..SetPix|
|000012d0| 65 6c 73 51 75 69 63 6b | 6c 79 28 72 2e 6c 65 66 |elsQuick|ly(r.lef|
|000012e0| 74 2c 6a 2b 72 2e 74 6f | 70 2c 72 6f 77 2c 53 49 |t,j+r.to|p,row,SI|
|000012f0| 5a 45 29 3b 0d 09 7d 0d | 09 70 72 69 6e 74 66 28 |ZE);..}.|.printf(|
|00001300| 22 44 6f 6e 65 2e 20 48 | 69 74 20 72 65 74 75 72 |"Done. H|it retur|
|00001310| 6e 20 74 6f 20 71 75 69 | 74 2e 5c 6e 22 29 3b 0d |n to qui|t.\n");.|
|00001320| 09 67 65 74 73 28 73 74 | 72 69 6e 67 29 3b 0d 09 |.gets(st|ring);..|
|00001330| 53 65 74 50 6f 72 74 28 | 28 57 69 6e 64 6f 77 50 |SetPort(|(WindowP|
|00001340| 74 72 29 6f 6c 64 50 6f | 72 74 29 3b 0d 09 47 44 |tr)oldPo|rt);..GD|
|00001350| 44 69 73 70 6f 73 65 57 | 69 6e 64 6f 77 31 28 77 |DisposeW|indow1(w|
|00001360| 69 6e 64 6f 77 29 3b 0d | 09 61 62 6f 72 74 28 29 |indow);.|.abort()|
|00001370| 3b 0d 7d 0d 00 00 00 00 | 00 00 00 00 00 00 00 00 |;.}.....|........|
|00001380| 00 00 01 00 00 00 01 18 | 00 00 00 18 00 00 00 32 |........|.......2|
|00001390| 00 00 06 05 0a 51 4d 20 | 52 65 6d 6f 74 65 aa 00 |.....QM |Remote..|
|000013a0| 02 00 00 00 61 64 72 70 | 43 45 44 41 81 00 01 04 |....adrp|CEDA....|
|000013b0| 09 47 72 61 74 69 6e 67 | 2e 63 02 00 00 00 54 45 |.Grating|.c....TE|
|000013c0| 58 54 4b 41 48 4c 00 00 | 00 00 00 00 00 00 00 00 |XTKAHL..|........|
|000013d0| 00 00 54 45 58 54 4b 41 | 48 4c 00 00 00 00 00 00 |..TEXTKA|HL......|
|000013e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013f0| 00 00 a7 e5 d5 7e 00 00 | 00 00 00 00 01 4a 00 00 |.....~..|.....J..|
|00001400| 00 00 00 00 00 00 10 00 | 00 00 06 05 0a 51 55 45 |........|.....QUE|
|00001410| 44 2f 4d 20 32 2e 35 00 | 02 00 00 00 41 50 50 4c |D/M 2.5.|....APPL|
|00001420| 51 45 44 31 81 00 00 00 | 00 c0 00 00 00 00 22 1e |QED1....|......".|
|00001430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 02 1d |........|........|
|00001440| 00 00 06 00 a7 ba 66 3d | a7 ba 66 3d 00 00 00 00 |......f=|..f=....|
|00001450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 6c e7 |........|......l.|
|00001470| 00 01 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001480| 00 00 00 14 00 00 12 cd | 00 80 00 00 00 00 00 00 |........|........|
|00001490| 10 62 00 6d 00 00 00 00 | 00 00 01 00 00 00 01 18 |.b.m....|........|
|000014a0| 00 00 00 18 00 00 00 32 | 00 5d 23 78 14 92 00 00 |.......2|.]#x....|
|000014b0| 00 1c 00 32 00 00 42 4b | 50 54 00 00 00 0a 14 5c |...2..BK|PT.....\|
|000014c0| ff ff 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+